using System;
using System.Collections.Generic;
using System.Text;
using Impact.Model.Objects;

namespace Impact.Model.Service
{
    /// <summary>
    /// defines the functions available from the service providing page data
    /// </summary>
    public interface IPageService
    {

        /// <summary>
        /// retrieve the given page by ID
        /// </summary>
        ImpactPage FetchByID(int pageId);

        /// <summary>
        /// retrieve a page using the given key
        /// </summary>
        ImpactPage FetchByKey(string pageKey);

        /// <summary>
        /// retrieve all pages
        /// </summary>
        /// <param name="onlyEnabled">true to only retrieve the pages that are enabled, 
        /// false to retrieve all pages regardless of their enabled state</param>
        ImpactPageCollection FetchAllPages(bool onlyEnabled);

        /// <summary>
        /// retrieves any pages that have a title or body text that is similar to the terms given
        /// </summary>
        ImpactPageCollection FetchByTerms(string terms);
        
        /// <summary>
        /// retrieve all ImpactPage objects that are marked as templates
        /// </summary>
        TemplateCollection FetchAllTemplates();

        /// <summary>
        /// Gets the list of ImpactPages that have this ImpactPage as their parent
        /// </summary>
        /// <param name="parentPageId">ID of the parent page to retrieve children for.  
        /// use -1 to get top level pages</param>
        /// <param name="onlyEnabled">true to retrieve only enabled child pages, false to retrieve all child pages</param>
        ImpactPageCollection FetchChildPages(int parentPageId, bool onlyEnabled);

        /// <summary>
        /// saves the given page without a responsible user
        /// </summary>
        void Save(ImpactPage page);
        
        /// <summary>
        /// save the given page with the given userId as responsible for the changes
        /// </summary>
        void Save(ImpactPage page, Guid userId);

        /// <summary>
        /// deletes the given page from the system, and any items referencing it
        /// </summary>
        void Remove(int pageId);

    }
}
